package com.mender.trade.mapper;

import com.mender.domain.dto.GoodsSalesDTO;
import com.mender.trade.domain.po.OrderDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface OrderDetailMapper {

    /**
     * 批量插入订单明细
     * @param orderDetailList
     */
    void insertBatch(List<OrderDetail> orderDetailList);

    /**
     * 根据订单id查询订单明细
     * @param orderId
     * @return
     */
    @Select("select * from order_detail where order_id = #{orderId}")
    List<OrderDetail> getOrderDishes(Long orderId);

    /**
     * 动态查询订单明细
     * @param orderDetail
     * @return
     */
    List<OrderDetail> select(OrderDetail orderDetail);

    /**
     * 根据指定的时间查询销量前10
     * @param beginTime
     * @param endTime
     * @return
     */
    List<GoodsSalesDTO> getTop10(LocalDateTime beginTime, LocalDateTime endTime);
}
